# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Veeti Paananen <veeti.paananen@rojekti.fi>

pkgname=cmark-gfm
pkgver=0.29.0.gfm.11
pkgrel=1
pkgdesc="GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C"
arch=('loong64' 'x86_64')
url="https://github.com/github/cmark"
license=('custom:BSD2')
depends=('glibc')
makedepends=('cmake' 'python')
source=("$url/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('b2b54d5cbf2a28f3f81febe5f45cfd5b821be4d4801e676edfa44e8ab115956146aa3ef5afa8e93cfaded7d74473ebb9d7a20d31fdd4bfc6cd80d8f05e8f704c')

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    ../cmark-gfm-$pkgver
  make
}

check() {
  cd build
  make test
}

package() {
  cd build
  make install DESTDIR="$pkgdir"
  install -Dm0644 -t "$pkgdir"/usr/share/licenses/$pkgname/ "$srcdir"/cmark-gfm-$pkgver/COPYING
}
